<include file="Public:head"/>
		<div class="col-xs-12">
			<div class="tabbable">
				<ul class="nav nav-tabs padding-12 tab-color-blue background-blue" id="myTab">
					<li class="active"> <a href="#home" data-toggle="tab">分配权限</a></li>
				</ul>
				<div class="tab-content">
					<blockquote style="margin-top: 10px;" class="layui-elem-quote">为<span style="color:red"> {$group_data['title']} </span>分配权限</blockquote>
					<form action="" method="post" id="rule_group"> 
						<input type="hidden" name="id" value="{$group_data['id']}">
						<table class="layui-table">
							<foreach name="rule_data" item="v">
								<empty name="v['_data']">
									<tr class="b-group">
										<th width="10%"> 
											<label>{$v['title']}
												<input type="checkbox" name="rule_ids[]" value="{$v['id']}" <if condition="in_array($v['id'],$group_data['rules'])"> checked="checked"</if> onclick="checkAll(this)" >
											</label>
										</th>
										<td></td>
									</tr>
								<else/>
									<tr class="b-group">
										<th width="10%">
											<label>{$v['title']} 
												<input type="checkbox" name="rule_ids[]" value="{$v['id']}" <if condition="in_array($v['id'],$group_data['rules'])"> checked="checked"</if> onclick="checkAll(this)">
											</label>
										</th>
										<td class="b-child">
											<foreach name="v['_data']" item="n">
												<table class="table table-striped table-bordered table-hover table-condensed">
													<tr class="b-group">
														<th width="10%"> 
															<label>{$n['title']} 
																<input type="checkbox" name="rule_ids[]" value="{$n['id']}" <if condition="in_array($n['id'],$group_data['rules'])"> checked="checked"</if> onclick="checkAll(this)">
															</label>
														</th>
														<td>
															<notempty name="n['_data']">
																<volist name="n['_data']" id="c"> 
																	<label>&emsp;{$c['title']} 
																		<input type="checkbox" name="rule_ids[]" value="{$c['id']}" <if condition="in_array($c['id'],$group_data['rules'])"> checked="checked"</if> >
																	</label>
																</volist>
															</notempty>
														</td>
													</tr>
												</table>
											</foreach>
										</td>
									</tr>
								</empty>
							</foreach>
							<tr>
								<th></th>
								<td> 
									
									<!-- <input class="btn btn-success" type="submit" value="提交"> -->
									<a class="btn btn-success" href="javascript:;" onclick="ajax_post_curl('{:U('Admin/Rule/rule_group', array('id'=>I('get.id')))}', 'rule_group')">提交</a>
									<a href="{:U('group')}" class="btn btn-danger" style="margin-left:20px;">返回</a>
								</td>
							</tr>
						</table>
					</form>
				</div>
			</div>
		</div>
		<!-- {:U('Admin/Rule/rule_group', array('id'=>I('get.id')))} -->
<script>
	function checkAll(obj){
		$(obj).parents('.b-group').eq(0).find("input[type='checkbox']").prop('checked', $(obj).prop('checked'));
	}
</script>
<include file="Public:foot"/>